/**
 * 
 */
package cn.jhz.filesharingsystem.dao;

import java.io.IOException;

import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.highlight.InvalidTokenOffsetsException;

import cn.jhz.filesharingsystem.model.FileArticle;
import cn.jhz.filesharingsystem.model.Pager;
import cn.jhz.filesharingsystem.model.SharedFile;

/**
 * IndexDao:操作索引库,实现对索引库的基本操作(增,删,改,查)
 * @author asus
 */
public interface IndexDao {
	/**
	  *  添加索引
	 * @param index
	 * @throws IOException
	 */
	public void addIndex(SharedFile index) throws IOException;
	
	/**
	  *  删除索引
	 * @param id
	 * @throws IOException
	 */
	public void deleteIndex(String id) throws IOException;
	
	/**
	  *  修改索引
	 * @param index
	 * @throws IOException
	 */
	public void updateIndex(SharedFile index) throws IOException;
	
	/**
	  * 查询索引
	 * @param query
	 * @param indexSearcher
	 * @return
	 * @throws IOException
	 * @throws InvalidTokenOffsetsException
	 */
	public Pager<FileArticle> getSearchPage(Query query, IndexSearcher indexSearcher) throws IOException, InvalidTokenOffsetsException;
}
